<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="/template/principal.xhtml">
        <ui:define name="conteudo">
            <p:panel header="Cadastro de Equipe">
                <p:messages globalOnly="true"/>
                <p:tabView >
                    <p:tab title="Dados da Equipe" >
                        <h:form>
                            <h:panelGrid columns="2" rendered="#{param['acao'] ne 'e'}">
                                <h:outputText value="Nome:"/>
                                <h:outputText value="#{equipe.novaequipe.nome}"/>
                                
                                <p:commandButton value="Editar equipe" action="#{equipe.editar}" ajax="false"/>
                            </h:panelGrid>
                        </h:form>
                        <h:form>
                            <h:panelGrid columns="3" rendered="#{param['acao'] eq 'e'}">
                                <h:outputText value="Nome:"/>
                                <p:inputText id="nome" value="#{equipe.novaequipe.nome}" size="35" maxlength="35" required="true" requiredMessage="Campo Obrigatório"/>
                                <p:message for="nome"/>
                                
                                <h:panelGrid columns="1">
                                    <p:commandButton value="Salvar" action="#{equipe.salvar}" ajax="false"/>
                                </h:panelGrid>
                            </h:panelGrid>
                        </h:form>      
                    </p:tab>
                    <p:tab title="Lista de Tecnico da Equipe" >
                        <h:form>
                            <p:dataTable value="#{equipe.novaequipe.tecnicoBeanCollection}" var="t" rows="10" dynamic="false" paginator="true" 
                                         selectionMode="multiple" selection="#{equipe.tecnicos}" emptyMessage="Nenhum Tecnico cadastrado nesta equipe">
                                <p:column headerText="Nome" style="width: 30%"  >
                                    <h:outputText value="#{t.fkPessoa.nome}"/>
                                </p:column>
                                <p:column headerText="Funcao" style="width: 30%">
                                    <h:outputText value="#{t.fkFuncao.descricao}"/>
                                </p:column>
                                <p:column headerText="Celular" style="width: 20%">
                                    <h:outputText value="#{t.fkPessoa.celular1}"/>
                                </p:column>
                            </p:dataTable>
                            <br/>
                        </h:form>
                    </p:tab>
                </p:tabView>
            </p:panel>

        </ui:define>
    </ui:composition>
</html>


